﻿<!-- saved from url=(0014)about:internet -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title></title>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=yes" />
    <style type="text/css">
        html
        {
            height: 100%;
        }
        body
        {
        	margin: -15px -15px -15px -15px;
            padding: 0px;
        }
        #map_canvas
        {
            height: 100%;
        }
    </style>
    <!--<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false">
    </script>-->
    <script src="https://www.google.com/jsapi?key=ABQIAAAAs-VbJ68NzKb8ep8JJXLYfBRi_j0U6kJrkFvY4-OX2XYmEAa76BQz3ld5FIzM7UO326g2jeh2gEEbeQ"></script>
    <script type="text/javascript">

        var ge;
        google.load("earth", "1");

        ///////////////////////////////////////////////////////////////////////
        //
        function Init() {
        	try {
        		google.earth.createInstance('map3d', initCB, failureCB);
        	}
        	catch (err) { }
        }

        ///////////////////////////////////////////////////////////////////////
        //
        function initCB(instance) {
			try {
				ge = instance;
				ge.getWindow().setVisibility(true);
				ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true);
				ge.getLayerRoot().enableLayerById(ge.LAYER_ROADS, true);

				ge.getTime().getControl().setVisibility(ge.VISIBILITY_HIDE);

				Reset();
			}
			catch (err) { }
        }

        ///////////////////////////////////////////////////////////////////////
        //
        function failureCB(errorCode) {
        }

        google.setOnLoadCallback(Init);

        ///////////////////////////////////////////////////////////////////////
        // if the following functions (pan, zoom, and tilt) are broken, or if new 
        // functions are to be implemented check:
        // http://code.google.com/apis/earth/documentation/camera_control.html
        // for the API.
        ///////////////////////////////////////////////////////////////////////
        
		///////////////////////////////////////////////////////////////////////
		// Reset the point of view
        function Reset() {
        	try {
        		ge.getOptions().setFlyToSpeed(ge.SPEED_TELEPORT);
        		var lookAt = ge.createLookAt('');
        		lookAt.set(40.633172, //lat
				   -8.659341,   //lng
				   300, 	      //alt
				   ge.ALTITUDE_RELATIVE_TO_GROUND,
				   0,
				   0,
				   90);

        		ge.getView().setAbstractView(lookAt);
        	}
        	catch (err) { }
        }

		///////////////////////////////////////////////////////////////////////
		// Animation from far away into a zoomed in state
		function Animate() {
			try {
				ge.getOptions().setFlyToSpeed(ge.SPEED_TELEPORT);
			
				var lookAt = ge.createLookAt('');
				lookAt.set(0.633172,	//lat
					   -0.659341,		//lng
					   2000000000,		//alt
					   ge.ALTITUDE_RELATIVE_TO_GROUND,
					   0,
					   0,
					   90);

				ge.getView().setAbstractView(lookAt);

				//zoom in to default location
				ge.getOptions().setFlyToSpeed(0.05);
				var lookAt2 = ge.createLookAt('');
				lookAt2.set(40.633172,	//lat
					   -8.659341,		//lng
					   300,				//alt
					   ge.ALTITUDE_RELATIVE_TO_GROUND,
					   0,
					   0,
					   90);

				ge.getView().setAbstractView(lookAt2);

				ge.getOptions().setFlyToSpeed(ge.SPEED_TELEPORT);
			}
			catch (err) { }
		}

		///////////////////////////////////////////////////////////////////////
		//
        function Pan(x, y) {
        	// Get the current view
            var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
            var newx = x * (lookAt.getRange()/50000000);
            var newy = y * (lookAt.getRange()/50000000);

            lookAt.setLatitude(lookAt.getLatitude() + newx);
            lookAt.setLongitude(lookAt.getLongitude() + newy);
            lookAt.setRange(lookAt.getRange());
            // Update the view in Google Earth
            ge.getView().setAbstractView(lookAt);
        }

        ///////////////////////////////////////////////////////////////////////
        //
        function Zoom(val) {
            // Get the current view
        	var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);

            if ( (val < 1) && (lookAt.getRange() <= 200)) return;
            if ((val > 1) && (lookAt.getRange() >= 900000)) return;

            //window.alert(lookAt.getRange());
            lookAt.setRange(lookAt.getRange()*val);

            // Update the view in Google Earth
            ge.getView().setAbstractView(lookAt);
        }

        ///////////////////////////////////////////////////////////////////////
        //
        function Tilt(val) {
            // Get the current view
            var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);

            lookAt.setTilt(val);

            // Update the view in Google Earth
            ge.getView().setAbstractView(lookAt); 
        }
    
    </script>
</head>
<body>
    <div id="map3d" style="width: 100%; height: 100%">
    </div>
</body>
</html>
